package org.mm4juser.entity;

import jakarta.persistence.Column;
import jakarta.persistence.DiscriminatorValue;
import jakarta.persistence.Entity;
import lombok.*;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.UUID;

@Data
@Entity
@DiscriminatorValue("tb_user")
@AllArgsConstructor
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class User extends BaseTable implements Serializable {
	@Serial
	private static final long serialVersionUID = 1L;
	//	用户类主要属性
	@Column
	@NonNull
	private String username;//用户名
	@Column
	@NonNull
	private String password;//密码
	@Column
	@NonNull
	private String email;//邮箱
	@Column
	@NonNull
	private String uuid;//UUID,不可更改
	@Column
	private String avatar;//头像
	//	用户类次要属性
	@Column
	private String signature;//个签
	@Column
	private int gender;//性别
	@Column
	private LocalDate birthday;//生日
	
	/**
	 * 生成UUID
	 *
	 */
	public String createUUID() {
		return UUID.randomUUID()
			.toString();
	}
}
